package com.tian.producer;

import com.alibaba.fastjson.JSON;
import com.tian.constant.RabbitMQConstant;
import com.tian.message.SmsSendMessage;
import com.tian.util.BaseProducer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * {@code @description:} 短信发送
 *
 * @author tianwc 公众号：Java后端技术全栈
 * 在线刷题 1200+java面试题和1000+篇技术文章：<a href="https://woaijava.cc/">博客地址</a>
 * {@code @date:} 2024/1/26 20:59
 * {@code @version:} 1.0
 */
@Slf4j
@Component
public class SmsProducer {
    @Resource
    private BaseProducer baseProducer;

    public void send(SmsSendMessage smsSendMessage) {
        String content = JSON.toJSONString(smsSendMessage);
        baseProducer.sendSimple(content, RabbitMQConstant.SMS_QUEUE, RabbitMQConstant.SMS_ROUTING_KEY);
    }
}
